package com.bw.mapper;

import com.bw.bean.Vo;
import com.bw.bean.Vo1;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName VoMapper
 * @description: TODO
 * @date 2025年05月09日
 * @version: 1.0
 */
@Mapper
public interface VoMapper {
    @Select("select c.name,sum(final_total_amount) `value` from order_info oi\n" +
            "left join order_detail od on oi.id = od.order_id\n" +
            "left join sku_info si on si.id = od.sku_id\n" +
            "left join base_category3 b on b.id = si.category3_id\n" +
            "left outer join base_category2 c on c.id = b.category2_id\n" +
            "group by c.name\n" +
            "order by sum(final_total_amount) asc;")
    List<Vo> getList();

    @Select("select concat(substr(ui.birthday,3,1),'0后') name,sum(final_total_amount) `value`  from order_info oi\n" +
            "left outer join user_info ui on ui.id = oi.user_id\n" +
            "group by concat(substr(ui.birthday,3,1),'0后')")
    List<Vo> getList1();

    @Select("select yys name,sum(final_total_amount) `value` from order_info where yys is not null\n" +
            "group by yys;")
    List<Vo> getList2();

    @Select("select bt.name,if(ui.gender='F','女','男') gender,sum(final_total_amount) `value` from order_info oi\n" +
            "left join order_detail od on oi.id = od.order_id\n" +
            "left join sku_info si on si.id = od.sku_id\n" +
            "left join base_trademark bt on bt.id = si.tm_id\n" +
            "left join user_info ui on oi.user_id = ui.id\n" +
            "group by bt.name,ui.gender;")
    List<Vo1> getList3();
}
